package com.trantor.stockmarketwatch;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.GridView;

public class MainActivity extends Activity {
	// Button Click Listener
	private OnClickListener buttonOnClickListener = new OnClickListener() {
		@Override
		public void onClick(View v) {
			Button button = (Button) v;
			if (button == null) {
				return;
			}

			switch (button.getId()) {
			case R.id.refreshButton:
				getStockPrice();
				break;
			}
		}
	};
	
	private void getStockPrice() {
		
		StockPriceCommands prices = new StockPriceCommands();
		List<String> results = prices.run(new String[]{"USLV", "VNM"});
		

			GridView stocksGrid = (GridView) findViewById(R.id.stocksList);
			List<StockEntry> stocksList = new ArrayList<StockEntry>();

			//StocksListAdapter sla = new StocksListAdapter(this, prices);
			//stocksGrid.setAdapter(sla);
	}
		
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		// Capture our button from layout
		registerOnClickListener(findViewById(R.id.refreshButton),
				buttonOnClickListener);
	}
	
	private void registerOnClickListener(View v, OnClickListener l) {
		v.setOnClickListener(l);
	}
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}
	
	

}
